import service from "../utils/request";

// 用户注册
export function userRegistration(obj) {
    return service.post('/shopBack/user/userRegistration', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

// 插入首页轮播图数据
export function insertMainImage(obj) {
    return service.post('/shopBack/mainImage/insertMainImage', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

// 新增商品
export function addGoods(obj) {
    return service.post('/shopBack/goodsInfo/addGoods', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

//新增购物车
export function insertCartInfo(obj) {
    return service.post('/shopBack/cart/insertCartInfo', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

//上传本地文件
export function loadLocalFile(obj) {
    return service.post('/shopBack/file/loadLocalFile', obj, {
        headers: { 'Content-Type': 'application/json' },
    })
}

//原文件名(不能中文)-跨域上传图片到服务器-
export function uploadImageToServerOriginalName(file) {
    return service.post('/shopBack/file/uploadImageToServerOriginalName', file, {
        headers: { 'Content-Type': 'multipart/form-data' },
    })
}

//随机文件名(可中文)跨域上传图片到服务器
export function uploadImageToServerRandName(file) {
    return service.post('/shopBack/file/uploadImageToServerRandName', file, {
        headers: { 'Content-Type': 'multipart/form-data' }
    })
}

//更新商品数据
export function updateGoods(obj) {
    return service.post('/shopBack/goodsInfo/updateGoods', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

//新增订单
export function addGoodsOrder(obj) {
    return service.post('/shopBack/goodsOrder/addGoodsOrder', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}

// 新增评论
export function addComment(obj) {
    return service.post('/shopBack/comment/addComment', JSON.stringify(obj), {
        headers: { 'Content-Type': 'application/json' }
    })
}